package com.zzyl.nursing.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.xml.bind.v2.TODO;
import com.zzyl.nursing.domain.Reservation;
import com.zzyl.nursing.domain.Room;
import com.zzyl.nursing.dto.ReservationDTO;
import com.zzyl.nursing.mapper.MemberReservationMapper;
import com.zzyl.nursing.mapper.RoomMapper;
import com.zzyl.nursing.service.IMemberReservationService;
import com.zzyl.nursing.vo.TimeCountVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;


@Service
public class MemberReservationServiceImpl extends ServiceImpl<MemberReservationMapper, Reservation> implements IMemberReservationService {

    @Autowired
    private MemberReservationMapper memberReservationMapper;

    @Override
    public List<TimeCountVo> getCountByTime(Long time) {
        LocalDateTime timeNow = LocalDateTimeUtil.of(time);
        return memberReservationMapper.getCountByTime(timeNow);
    }

    @Override
    public void addReservation(ReservationDTO reservationDTO) {
        Reservation reservation = BeanUtil.copyProperties(reservationDTO, Reservation.class);
        memberReservationMapper.addReservation(reservation);
    }
    @Override
    public List<Reservation> selectReservationList(ReservationDTO reservationDTO) {
        return memberReservationMapper.selectReservationList(reservationDTO);
    }

    @Override
    public void updateReservation() {
        memberReservationMapper.updateReservation();
    }


}
